# Contributor: Marian Buschsieweke <marian.buschsieweke@posteo.net>
maintainer="Marian Buschsieweke <marian.buschsieweke@posteo.net>"
pkgname=py3-progressbar2
_pkgname=progressbar2
pkgver=4.5.0
pkgrel=0
pkgdesc="Text progress bar library for Python"
url="https://github.com/WoLpH/python-progressbar"
arch="noarch !s390x" # py3-utils
license="BSD-3-Clause"
depends="python3 py3-utils py3-freezegun"
makedepends="
	py3-gpep517
	py3-setuptools
	"
checkdepends="
	py3-dill
	py3-pytest
	py3-pytest-cov
	"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-progressbar" # for backwards compatibility
provides="py-progressbar=$pkgver-r$pkgrel" # for backwards compatibility


build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	gpep517 install-wheel --destdir .testenv --prefix '' .dist/*.whl
	.testenv/bin/python3 -m pytest \
		--cov-fail-under 0
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl
}

sha512sums="
84d13cce516aebc184285479849a1f4d16d16bbd48c7eab55c28ce131f5c770d97368df1ca57499a59e4d2994bce5a0cef7cc3d7c3a358b2dd6beba785f5db33  progressbar2-4.5.0.tar.gz
"
